package com.it.dao;

import com.it.domain.Bills;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface BillsDao {
    /**
     * 查询所有账单
     * @return
     */
    @Select("Select * from Bills")
    List<Bills> FindAllBills(int page,int size);

    /**
     * 查询所有账单
     * @return
     */
    @Select("Select * from Bills")
    List<Bills> FindAllBills1();

    /**
     * 新增数据
     * @param bills
     */
    @Insert("INSERT INTO Bills (profit,credit,pay_out,reason,operation_date)VALUES(#{profit},#{credit},#{pay_out},#{reason},#{operation_date})")
    void insertBills(Bills bills);

    /**
     * 查询日期范围
     */
    @Select("SELECT * FROM Bills WHERE operation_date  BETWEEN #{date01} AND #{date02}")
    List<Bills> findBillsDate(@Param("date01")Date date01, @Param("date02")Date date02, int page, int size);

    /**
     * 查询日期范围
     * @param date01
     * @param date02
     * @return
     */
    @Select("SELECT * FROM Bills WHERE operation_date  BETWEEN #{date01} AND #{date02}")
    List<Bills> findBillsDate1(@Param("date01")Date date01, @Param("date02")Date date02);
}
